﻿@using ST = EmoneyWeiXinCommon.StringTools;
@using System.Data;
@using EmoneyWeiXinEntity;
@{
    ViewBag.Title = "NewsReoprtfbEdit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    var ds = (DataSet)ViewBag.memulist;
    DataTable menulist = null;
    if (ds != null && ds.Tables.Count > 0)
    {
        menulist = ds.Tables[0];
    }
}

<script src="@ST.GetStaticFile("ueditor/ueditor/ueditor.config.js")" type="text/javascript"></script>
<script src="@ST.GetStaticFile("ueditor/ueditor/ueditor.all.js")" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
    //window.UEDITOR_HOME_URL = EDIT_HOME_URL;
    window.UEDITOR_HOME_URL = "@EmoneyWeiXinCommon.Config.EDIT_HOME_URL";
</script>
<script type="text/javascript">
    var editor = new UE.ui.Editor();
    $(function () {
        editor.render("txtContent");
        // memutype(function () { });
        @*if ("@ViewBag.pt" != "1") {
           
        }
        else {
            //$("#txtContent").attr("readonly", true);
            $("#divContent").css("display", "");
            $("#txtContent").css("display", "none");
        }*@
        var isnew = "@ViewBag.id" == "0";
        var nptype = "@ViewBag.nptype";//页面类型  

        if (!isnew) {
           

            $("#drpNewsType").val("@ViewBag.model.MemuType");
          @*  //$("#txtSource").val("@ViewBag.model.source");*@
            $("#drpPubMethod").val("@ViewBag.model.PubMethod");
            if ("@ViewBag.model.PubStatus" == "3") $("#rdoEnableYes").attr("checked", true);
            else if ("@ViewBag.model.PubStatus" == "2") $("#rdoCheckNo").attr("checked", true);
            else $("#rdoEnableNo").attr("checked", true);
           
           
           @* var imgurl = "@ViewBag.model.ImageUrl";
            if (imgurl != "") {
                $("#Image1").css("width", 200);
                $("#Image1").css("height", 200);
                $("#Image1").attr("src", "@ViewBag.model.ImageUrl");
            }*@
           @* $("#txtSummary").val("@ViewBag.model.Summary");*@
            
           @* if ("@ViewBag.pt" != "1") {
                var tmp = "@ViewBag.model.Content";
                tmp = tmp.replace(/arbrcr/g, "\r\n");
                $("#txtContent").html(tmp);
            }
            else {
                $("#divContent").html('@Html.Raw(ViewBag.model.Content)');
            }

            $("#txtOutsideUrl").val("@ViewBag.model.OutsideUrl");*@

            
        }
        $("#btnBack1").click(function () {
            var pt = queryString(window.location.href, "pt");
            if (pt == 1) {
                document.location.href = "NewsReportList?ntype=" + nptype + "&leftid=@ViewBag.leftid";
                // var url = "@ST.GetTrendsFile("NewsReportList?ntype=" + ViewBag.nptype + "&leftid=" + ViewBag.leftid)";
                // window.open(url, "_blank");
            }
            else {
                document.location.href = "NewsReportfbList?ntype=" + nptype + "&leftid=@ViewBag.leftid";
                // var url = "@ST.GetTrendsFile("NewsReportfbList?ntype=" + ViewBag.nptype + "&leftid=" + ViewBag.leftid)";
                //window.open(url, "_blank");
            }
        });
        $("#btnSave").click(function () {
            if ($("#txtTitle").val() == "") {
                alert("请填写标题");
                $("#txtTitle").focus();
                return false;
            }
            if ($("#txtSummary").val() == "") {
                alert("请填写摘要");
                $("#txtSummary").focus();
                return false;
            }
            if ("@ViewBag.pt" != "1") {
                if ($("#txtContent").val() == "") {
                    alert("请填写内容");
                    $("#txtContent").focus();
                    return false;
                }
            }
        });

        $("#txtTitle").change(function () {
            $("#showTitle").text($(this).val());
        });
        $("#txtSummary").change(function () {
            $("#showSummary").text($(this).val());
        });
    });
</script>
@{
    var read = "";
    var disabled = "";
    var display = "";
    
}
@using (Html.BeginForm("uploadNews", "Report", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
   
    <div class="right">
        <input type="hidden" value="@ViewBag.id" id="hdnid" name="hdnid" />
        <input type="hidden" value="@ViewBag.nptype" id="hdnptype" name="hdnptype" />
        <input type="hidden" value="@ViewBag.pt" id="hdnpt" name="hdnpt" />
        <input type="hidden" value="@ViewBag.leftid" id="hdleftid" name="hdleftid" />
        <h3>@Html.Raw(ViewBag.pt == "1" ? "资讯发布" : "素材发布")</h3>
        <!--manage-->
        <div class="manage">
            <!--manage_left-->
            <div class="manage_left">
                <!--manage_left_top-->
                <div class="manage_left_top">
                    <h4 id="showTitle">@ViewBag.model.title</h4>
                    <p class="manage_left_top_font">
                        <a>
                            <img id="showImg" src="@ViewBag.model.ImageUrl"></a>
                    </p>
                    <p class="manage_left_top_font02">
                        <a id="showSummary">@ViewBag.model.Summary</a>
                    </p>
                </div>
                <!--manage_left_top end-->
                <p class="manage_line"></p>

            </div>
            <!--manage_left end-->
            <!--manage_right-->
            <div class="manage_right">
                <!--manage_top-->
                <div class="manage_top">
                    <div class="manage_register">
                        <p id="pType">
                            <span>栏目：</span>
                            <select id="drpMemuType" name="drpNewsType"  @disabled  >
                                @{  if (menulist != null)
                                    {
                                        for (var i = 0; i < menulist.Rows.Count; i++)
                                        {
                                            if (ViewBag.nptype == menulist.Rows[i]["everyKey"].ToString())
                                            {
                                    <option value="@menulist.Rows[i]["everyKey"]" selected="selected">@menulist.Rows[i]["title"]</option>
                                            }
                                            else
                                            {
                                    <option value="@menulist.Rows[i]["everyKey"]">@menulist.Rows[i]["title"]</option>
                                            }
                                        }
                                    }
                                }

                            </select>
                        </p>
                        <p>
                            <span>来源：</span><select id="drpSource" name="drpSource" @disabled><option value="好股">好股</option>
                                <option value="官网">官网</option>
                                <option value="研报">研报</option>
                                <option value="信息部">信息部</option>
                            </select>
                        </p>
                    </div>
                    <div class="manage_register">
                        <p>
                            <span>发布方式：</span>
                            <select id="drpPubMethod" name="drpPubMethod" @disabled>
                                <option value="原创">原创</option>
                                <option value="转载">转载</option>
                                <option value="加工">加工</option>
                                <option value="抓取">抓取</option>
                            </select>
                        </p>
                        <p>
                            <span>发布状态：</span>
                            <input id="rdoEnableYes" type="radio" name="drpPubStatus" value="3" style='display:@(new EmoneyWeiXin.Controllers.BaseConfigurationController().DisplayOperate(1, ViewBag.leftid))'><label for="rdoEnableYes" style='display:@(new EmoneyWeiXin.Controllers.BaseConfigurationController().DisplayOperate(1, ViewBag.leftid))'>已发布</label>
                            <input id="rdoEnableNo" type="radio" name="drpPubStatus" value="1" checked="checked"><label for="rdoEnableNo">未发布</label>
                            <input id="rdoCheckNo" type="radio" name="drpPubStatus" value="2" style='display:@(ViewBag.pt == "1" ? "" : "none")'><label style='display:@(ViewBag.pt == "1" ? "" : "none")' for="rdoCheckNo">已推送</label>
                        </p>
                    </div>
                    <div class="manage_register">

                        <p class="manage_register_p"><span>文章标题：</span><input type="text" id="txtTitle" value="@ViewBag.model.title" name="txtTitle" ></p>
                    </div>
                    <div class="manage_register">
                        <p class="manage_register_p"><span>作者（选填）：</span><input type="text" id="txtAuthor" value="@ViewBag.model.Author" name="txtAuthor"></p>
                    </div>

                    <div class="manage_register">
                        <p class="manage_register_p manage_register_p04">
                            <span>封面：</span>
                            @*  <input type="button" value="上传" class="manage_register_text03">
                        <input type="button" value="从图片库选" class="manage_register_text03">*@

                            <img id="Image1" src="@ViewBag.model.ImageUrl" style="width:200px;height:200px" />
                            <input type="file" name="file" id="file" name="file" style="display:@display">
                        </p>

                    </div>
                </div>
                <!--manage_top end-->
                <p class="manage_line"></p>
                <!--manage_abstract-->
                <div class="manage_abstract">
                    <!--manage_abstract_box-->
                    <div class="manage_abstract_box">
                        <span class="manage_abstract_left">摘要：</span>
                        <div class="manage_abstract_right">
                            @* <p class="manage_abstract_right_font">*@
                            <textarea name="txtSummary" rows="2" cols="20" id="txtSummary"   style="height: 113px; width: 660px;" > @ViewBag.model.Summary</textarea>
                            @*</p>*@
                        </div>
                    </div>
                    <!--manage_abstract_box end-->
                </div>
                <!--manage_abstract end-->
                <p class="manage_line"></p>
                <!--manage_abstract02-->
                <div class="manage_abstract">
                    <!--manage_abstract_box02-->
                    <div class="manage_abstract_box manage_abstract_box02">
                        <span class="manage_abstract_left">正文：</span>
                        <div class="manage_abstract_right_font02">

                            @*<textarea id="txtContent" name="txtContent" class="manage_abstract_right_font02"></textarea>*@
                            <textarea name="txtContent" rows="2" cols="20" id="txtContent" style="height: 300px; width: 660px;" >@ViewBag.model.Content</textarea>
                            <div id="divContent" style="display: none">@ViewBag.model.Content</div>
                        </div>
                    </div>
                    <!--manage_abstract_box02 end-->
                    <div class="manage_register">
                        <p class="manage_register_p"><span>添加原文链接：</span><input type="text" name="txtOutsideUrl" id="txtOutsideUrl" value="@ViewBag.model.OutsideUrl"></p>
                    </div>
                    @* <div class="manage_register">*@
                    <p class="manage_add">
                        <input class="manage_add_input" type="submit" name="btnSave" value="保存" id="btnSave" style='display:@(new EmoneyWeiXin.Controllers.BaseConfigurationController().DisplayOperate(2, 3, ViewBag.leftid))'>
                        <a  href="@ST.GetTrendsFile("Report/NewsReportfbDetail?id=" + ViewBag.id)"  target="_blank">浏览</a>
                        <input class="manage_add_input" type="button" name="btnBack1" value="返回" id="btnBack1">
                    </p>

                    @*  <p class="manage_add">
         <input type="submit" value="提交" class="manage_add_input">
         <a href="#">保存</a>
         <input type="button" value="提交" class="manage_add_input">
       </p>*@

                    @*</div>*@
                </div>
                <!--manage_abstract02 end-->
            </div>
            <!--manege_right end-->
        </div>

        <!--manage end-->
    </div>
}